/*
 * GetCharges.h
 *
 *  Created on: Apr 13, 2010
 *      Author: marchi
 */

#ifndef GETCHARGES_H_
#define GETCHARGES_H_

static void calc_recipbox(matrix box,matrix recipbox)
{
  /* Save some time by assuming lower right part is zero */
  real tmp=1.0/(box[XX][XX]*box[YY][YY]*box[ZZ][ZZ]);
  recipbox[XX][XX]=box[YY][YY]*box[ZZ][ZZ]*tmp;
  recipbox[YY][XX]=0;
  recipbox[ZZ][XX]=0;
  recipbox[XX][YY]=-box[XX][YY]*box[ZZ][ZZ]*tmp;
  recipbox[YY][YY]=box[XX][XX]*box[ZZ][ZZ]*tmp;
  recipbox[ZZ][YY]=0;
  recipbox[XX][ZZ]=(box[XX][YY]*box[YY][ZZ]-box[YY][YY]*box[XX][ZZ])*tmp;
  recipbox[YY][ZZ]=-box[YY][ZZ]*box[XX][XX]*tmp;
  recipbox[ZZ][ZZ]=box[XX][XX]*box[YY][YY]*tmp;
}

extern int
get_charges(real*** , real***, real* ,int ,int ,int ,int ,atom_id *, t_trxframe*);

#endif /* GETCHARGES_H_ */
